<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
var objData=new Object();
$(function(){
	objData.folderId="<c:out value='${docFolderAsso.folderId}' />";
	objData.issueType="<c:out value='${docFolderAsso.issueType}' />";
	objData.folderAssoId="<c:out value='${docFolderAsso.folderAssoId}' />";
//	objData.description="<c:out value='${docFolderAsso.description}' />";
	objData.docId="<c:out value='${docFolderAsso.docId}' />";
	
	$("#folderTreeInSynergy").tree({
		animate:true,
		lines:true,
		url:"<c:url value='/docFolder/treeDate' />",
		queryParams:{"folderType":"<c:out value='${folderType}' />"},
		onSelect:function(node){
			objData.folderId=node.id;
		},
		onLoadSuccess:function(node, data){
			$("#folderTreeInSynergy span[class^='tree-icon']").removeClass("tree-folder tree-folder-open tree-file");    	
			if($("#folderTreeInSynergy").tree("getSelected")==null){
				if(objData.folderId == ""){
					$('#folderTreeInSynergy').tree('select',  $('#folderTreeInSynergy').tree('find', data[0].id).target);
				}else{
					$('#folderTreeInSynergy').tree('select',  $('#folderTreeInSynergy').tree('find', objData.folderId).target);
				}
			}
		}
	});
	
	$("#description").textbox({
		multiline:true,
		validType:'length[0,85]'
	});
});

function saveData(){
	objData.description=$("#description").textbox("getValue");
	var flag=false;
	$.ajax({
		   type: "POST",
		   url: "<c:url value='/docFolderAsso/docFolderAssoSave' />",
		   data: objData,
		   async: false,
		   success: function(msg){
		     if(msg.state=="200"){
		    	 flag=true;
		     }
		   }
		});
	return flag;
}

function saveDate2(){
	objData.description=$("#description").textbox("getValue");
	var obj=new Object();
	$.ajax({
		   type: "POST",
		   url: "<c:url value='/docFolderAsso/docFolderAssoSave' />",
		   data: objData,
		   async: false,
		   success: function(msg){
			   obj=msg;
		   }
		});
	return obj;
}